<template>
	<view class="caseinfo">
		<u-navbar
			:title="title"
			:back-icon-size="28"
			back-icon-color="#000000"
			:title-size="28"
			:border-bottom="false"
			:back-text-style="{ color: '#000000', fontSize: '26rpx' }"
			title-color="#000000"
			:background="{ background: '#ffffff' }"
		></u-navbar>
		<view class="imgul"><u-parse :html="content"></u-parse></view>
	</view>
</template>

<script>
export default {
	name: 'caseinfo',
	data() {
		return {
			title: '',
			content: ''
		};
	},
	//实例创建完成后被立即调用
	created() {},
	onLoad(option) {
		if (option) {
			this.item = JSON.parse(decodeURIComponent(option.item));
			console.log(this.item);
			this.title = this.item.user;
			this.getcaseinfo(this.item.id);
		}
	},
	//挂载开始之前被调用
	beforeMount() {},
	onPullDownRefresh() {
		//监听下拉刷新动作的执行方法，每次手动下拉刷新都会执行一次
		console.log('refresh');
		setTimeout(function() {
			uni.stopPullDownRefresh(); //停止下拉刷新动画
		}, 1000);
	},
	//初次渲染完成
	onReady() {},
	//全局只触发一次
	onLaunch() {},
	//从后台进入前台
	onShow() {},
	//前台进入后台
	onHide() {},
	methods: {
		getcaseinfo(id) {
			this.$u.api
				.getcaseinfo({
					id: id
				})
				.then(res => {
					console.log(res);
					let str = res.data.content;
					if (str.indexOf('img.letuilm.com') != -1) {
						this.content = str.replace(/src="img.letui/g, `src="//img.letui`);
					} else {
						this.content = str.replace(/\/public\/static/g, `//zsxt.letuilm.com/public/static`);
					}
				})
				.catch(err => {
					console.log(err);
				});
		}
	}
};
</script>

<style lang="scss" scoped>
.caseinfo {
}
</style>
